package com.fz.consumer.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutConfig {
    @Bean
    public FanoutExchange fanoutExchange5(){
        return new FanoutExchange("hmall.fanout5");
    }

    @Bean
    public Queue fanoutQueue51(){
        return new Queue("fanout5.queue1");
    }

    @Bean
    public Queue fanoutQueue52(){
        return new Queue("fanout5.queue2");
    }

    @Bean
    public Binding bindingQueue1(){
        return BindingBuilder.bind(fanoutQueue51()).to(fanoutExchange5());
    }

    @Bean
    public Binding bindingQueue2(Queue fanoutQueue52,FanoutExchange fanoutExchange5){
        return BindingBuilder.bind(fanoutQueue52).to(fanoutExchange5);
    }
}
